<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>{{$bags->books->book_name}}的转让详情 - 阅邻-夜读书</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="author" content="夜读书-阅邻，读身边的书，发现近在咫尺的朋友。">
    <meta name="description" content="夜读书中文网，阅邻">
    <meta name="keywords" content="书城,读书,阅读,小说,文学，阅邻">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="{{ asset('/bootstrap-3.3.5-dist/css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ asset('/style/css/yds.css') }}">
    <link rel="stylesheet" href="{{ asset('/style/css/bookshop.css') }}">
    <script src="{{ asset('/scripts/jquery/jquery-1.11.3.min.js') }}"></script>
    <script src="{{ asset('/bootstrap-3.3.5-dist/js/bootstrap.min.js') }}"></script>
</head>
<body class="docs">
@include('books.partials.navtop')
@include('books.partials.navshopsearch')

<div class="docs-wrapper container">

    <article>
    @if($bags->condition == 10)
        <?php $condition = '全新'; ?>
    @endif
    @if($bags->condition == 9)
        <?php $condition = '9成新'; ?>
    @endif
    @if($bags->condition == 8)
        <?php $condition = '8成新'; ?>
    @endif
    @if($bags->condition == 7)
        <?php $condition = '7成新'; ?>
    @endif
    @if($bags->condition == 6)
        <?php $condition = '6成新'; ?>
    @endif
    @if($bags->condition == 5)
        <?php $condition = '5成新'; ?>
    @endif
    @if($bags->condition == 0)
        <?php $condition = '较旧'; ?>
    @endif 

    @if($bags->scope == 'L')
        <?php $scope = "同城"; ?>
    @endif
    @if($bags->scope == 'R')
        <?php $scope = "不限"; ?>
    @endif
            
    {{-- J借阅，E交换，S出售，Z赠送 --}}
    @if($bags->otype == 'J')
        <?php $otype = '借阅'; ?>
    @elseif($bags->otype == 'E')
        <?php $otype = '交换'; ?>
    @elseif($bags->otype == 'S')
        <?php $otype = '￥' . $bags->nowprice; ?>
    @elseif($bags->otype == 'Z')
        <?php $otype = '赠送'; ?>
    @else
        <?php $otype = '￥' . $bags->nowprice; ?>
    @endif

    @if($bags->users->sex == 1)
        <?php $sex = "images/ico/male.png"; ?>
    @endif
    @if($bags->users->sex == 2)
        <?php $sex = "images/ico/female.png"; ?>
    @endif
    @if($bags->users->sex == 3)
        <?php $sex = "images/ico/sex_unknow.png"; ?>
    @endif

    @if($bags->users->avatar_file != null)
        <?php $touxiang = "http://www.yedushu.com/" . $bags->users->avatar_file_min; ?>
    @else
        <?php $touxiang = "http://www.yedushu.com/usersface/default/avatar-min.png"; ?>
    @endif

        <div id="shopinfo">
            <div class="cover">
                <img src="{{url($bags->books->bimg)}}" />
            </div>
            <div class="article">
                <p class="bookname">{{$bags->books->book_name}}</p>
                <p class="dingjia">定价：<span class="jia">￥{{$bags->books->dingjia}}</span></p>
                <p class="">
                @if($bags->otype == 'S')
                    <span class="now">夜读书价：</span><span class="price_now">{{$otype}}</span>
                @else
                    <span class="now">{{$otype}}估值：</span><span class="t_now">{{$bags->nowprice}}</span>
                @endif
                </p>
                <p class="author">作者：{{$bags->books->zuozhe}}</p>
                <p class="cbs">出版社：{{$bags->books->chubanshe}}</p>
                <p class="cbs">isbn：{{$bags->books->isbn}}</p>
                <div class="infotext">
                    <span class="">上架时间：{{date('Y-m-d', $bags->add_time)}}</span>
                    <span clas="">新旧程度：{{$condition}}</span>
                    <span class="">数量：{{$bags->num}}本</span>
                    <span class="">交易地点：{{$scope}}</span>
                </div>
                <div class="buy_box_btn">
                @if($bags->otype == 'S')
                    <a class="btn btn_red" onclick="alert('请下载夜读书APP购买')">加入购物车</a>
                    <a class="btn btn_b btn_b_red" onclick="alert('请下载夜读书APP购买')">立即购买</a>
                @else
                    <a class="btn btn_b_blue">可{{$otype}}</a>
                @endif
                </div>
                <div class="fuwu">
                @if($bags->otype == 'S')
                    温馨提示：由"夜读书"会员直接销售和发货，并提供售后服务。
                @else
                    温馨提示：{{$otype}}书籍由双方自愿发起，提倡同城书友就近线下{{$otype}}。
                @endif
                </div>
            </div>
            <div style="clear:both;"></div>
            <div class="purchase-actions">备注：</div>
            <div class="beizhu">
            @if($bags->beizhu != '')
            {!! $bags->beizhu !!}
            @else
            本商品没有留下备注信息。
            @endif
            </div>

            <div id="tabbox">
                <ul class="tabs" id="tabs">
                    <li><a href="" tab="tab1">商品介绍</a></li>
                    <li><a href="" tab="tab2">商品留言</a></li>
                </ul>
                <ul class="tab_conbox">

                    <li id="tab1" class="tab_con">
                        <span class="p1">内容简介</span> · · · · · ·
                        <div class="neirong">{!! $bags->books->neirongjianjie !!}</div>
                        <span class="p1">作者简介</span> · · · · · ·
                        <div class="zuozhe">{!! $bags->books->zuozhejianjie !!}</div>
                        <span class="p1">目录</span> · · · · · ·
                        <div class="mulu">{!! $bags->books->mulu !!}</div>
                    </li> 

                    <li id="tab2" class="tab_con">
                        <div class="liuyan">
                        @if(count($liuyans)==0)
                            <div class="item">暂无留言</div>
                        @else
                        @foreach($liuyans as $liuyan)
                        @if($liuyan->users->avatar_file != null)
                            <?php $liuyan_touxiang = "http://www.yedushu.com/" . $liuyan->users->avatar_file_min; ?>
                        @else
                            <?php $liuyan_touxiang = "http://www.yedushu.com/usersface/default/avatar-min.png"; ?>
                        @endif

                        @if($liuyan->users->sex == 1)
                            <?php $liuyan_sex = "images/ico/male.png"; ?>
                        @endif
                        @if($liuyan->users->sex == 2)
                            <?php $liuyan_sex = "images/ico/female.png"; ?>
                        @endif
                        @if($liuyan->users->sex == 3)
                            <?php $liuyan_sex = "images/ico/sex_unknow.png"; ?>
                        @endif

                        <div class="item">
                            <a href="{{url('u/'. $liuyan->users->uid)}}">
                            <img class="bimg" style="float:left;" src="{{$liuyan_touxiang}}"></img> 
                            </a> 
                            <dl style="margin-left:60px;">
                                <dt><img style="width:1em;height:1em" src="{{url($liuyan_sex)}}">
                                <span class="username"><a href="{{url('u/'. $liuyan->users->uid)}}">{{$liuyan->users->user_name}}</a></span>
                                <dt class="lytext">{{$liuyan->lytext}}</dt>
                                <dt><span style="float:right;padding-right:5px;font-size:10px">{{date('Y-m-d H:i:s', $liuyan->add_time)}}</span></dt></dt>
                            </dl>
                            <div style="clear:both"></div>
                        </div>
                        @endforeach
                        @endif
                        </div>
                    </li>

                </ul>
            </div>
        </div>  
    </article>

    <section class="sidebar">
    <div id="gundong">
        <div class="author-info">
            <div class="touxiang">
                <a href="{{url('u/' . $bags->users->uid)}}" target="_blank"><img class="avatar" src="{{url($touxiang)}}" /></a>
            </div>
            <div class="reginfo">
                <p class="name"><a href="{{url('u/' . $bags->users->uid)}}" target="_blank">{{$bags->users->user_name}}</a></p>
                <p class="regtime">加入时间：{{date('Y-m-d', $bags->users->reg_time)}}</p>
            </div>
        </div>
        <div style="clear:both;"></div>
        <div class="jieshao">
            @if($usersattribs != null)
                @if($usersattribs->shopjieshao !='')
                    {{$usersattribs->shopjieshao}}
                @else
                    这个人很懒，没留下书城介绍。
                @endif
            @else
                这个人很懒，没留下书城介绍。
            @endif
        </div>
    </div>
    </section>

</div>

@include('books.partials.footer')

<script type="text/javascript">
$(document).ready(function() {
    //tab选项卡
    jQuery.jqtab = function(tabtit,tabcon) {
        $(tabcon).hide();
        $(tabtit+" li:first").addClass("thistab").show();
        $(tabcon+":first").show();
    
        $(tabtit+" li").click(function() {
            $(tabtit+" li").removeClass("thistab");
            $(this).addClass("thistab");
            $(tabcon).hide();
            var activeTab = $(this).find("a").attr("tab");
            $("#"+activeTab).fadeIn();
            return false;
        });
        
    };
    /*调用方法如下：*/
    $.jqtab("#tabs",".tab_con"); 

//======================
    //滚动
    $.fn.smartFloat = function() {
        var position = function(element) {
            var top = element.position().top, pos = element.css("position");
            $(window).scroll(function() {
                var scrolls = $(this).scrollTop();
                if (scrolls > top) {
                    if (window.XMLHttpRequest) {
                        element.css({
                            position: "fixed",
                            top: 0
                        }); 
                    } else {
                        element.css({
                            top: scrolls
                        }); 
                    }
                }else {
                    element.css({
                        position: pos,
                        top: top
                    }); 
                }
            });
        };

        return $(this).each(function() {
            position($(this));      
        });
    };

    /*调用方法*/
    $("#gundong").smartFloat();  
});
</script>
</body>
</html>
